<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('rd_alarm_type', function (Blueprint $table) {
            $table->comment('报警消息类型');
            $table->bigIncrements('id');
            $table->string('name', 255)->comment('消息名');
            $table->bigInteger('voice_id')->default(0)->comment('语音播报ID');
            $table->unsignedTinyInteger('type')->comment('类型1:雷达2:相机');
            $table->integer('sort')->default(0)->comment('排序');
            $table->unsignedTinyInteger('level')->comment('风险等级1:创建工单2:喊话处理3:需查看4:预警');
            $table->string('risk_title', 255)->default('')->comment('预警信息标题');
            $table->string('risk_text', 255)->default('')->comment('预警信息文本');
            $table->unsignedTinyInteger('risk_level')->nullable()->comment('工单紧急程度1:一般2:紧急3:非常紧急');
            $table->unsignedInteger('expire_time')->nullable()->comment('工单整改限时');
            $table->string('icon', 255)->nullable()->comment('图标');
            $table->unique(['name', 'type'], 'idx_name_type');
            $table->authorBy();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('rd_alarm_type');
    }
};